package com.light.sword

import java.math.BigDecimal

class BigDecimalDemo {

    private fun testDoubleToInt() {
        val a = "1.0"
        val d = a.toDouble()
        val i = d.toInt()
        println(i.toString())

        val a1 = "2.0"
        val a2 = "1.8"
        var quotaValue = BigDecimal.ZERO
        quotaValue = quotaValue.add(BigDecimal.valueOf(java.lang.Double.valueOf(a1)))
        quotaValue = quotaValue.add(BigDecimal.valueOf(java.lang.Double.valueOf(a2)))
        quotaValue = quotaValue.setScale(0, BigDecimal.ROUND_HALF_UP)
        println(quotaValue)
    }
}
